# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=libnice
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=0.1.13
pkgrel=2
pkgdesc="An implementation of the IETF's draft ICE (for p2p UDP data streams) (mingw-w64)"
arch=('any')
url="https://nice.freedesktop.org/wiki/"
license=("LGPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-gstreamer"
             "${MINGW_PACKAGE_PREFIX}-gobject-introspection"
             "gtk-doc")
depends=("${MINGW_PACKAGE_PREFIX}-glib2")
optdepends=("${MINGW_PACKAGE_PREFIX}-gstreamer")
options=('staticlibs' 'strip')
source=("https://nice.freedesktop.org/releases/${_realname}-${pkgver}.tar.gz"
        0001-fix-redefinition-mingw-w64.patch
        0004-mingw-w64-types.patch)
sha256sums=('61112d9f3be933a827c8365f20551563953af6718057928f51f487bfe88419e1'
            'ed740c80bc885c5efef7a6fad0ee08bce46aa48e2d279963ccc024766674b90f'
            'eaa4b524ea9c9c3d59c60a60725189feba2906be8eb5209d6e6d402c3d50ac0f')

prepare() {
  cd ${_realname}-${pkgver}
  patch -p1 -i ${srcdir}/0001-fix-redefinition-mingw-w64.patch
  patch -p1 -i ${srcdir}/0004-mingw-w64-types.patch

  NOCONFIGURE=1 ./autogen.sh
}

build() {
  mkdir -p "${srcdir}/build-${MINGW_CHOST}"
  cd "${srcdir}/build-${MINGW_CHOST}"
  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-shared \
    --enable-static \
    --enable-introspection

  make
}

package() {
  cd "${srcdir}/build-${MINGW_CHOST}"
  make DESTDIR="${pkgdir}" install
  rm -f ${pkgdir}${MINGW_PREFIX}/lib/gstreamer*/*.a
}
